Overview
Fetches live corporate announcements (regulatory filings, events) for all stocks in the master ISIN list using the Dhan Static ScanX API. Results are aggregated into a single JSON file sorted by date. Source:fetch_new_announcements.pyPhase: Phase 2 (Enrichment)
Output:
all_company_announcements.json
API Endpoint
Request Payload
The ISIN code of the security to fetch announcements for
Example Request
Function Signature
Parameters
Stock trading symbol (e.g., “TATAPOWER”)
ISIN code used for API request
Company display name
Output Structure
Stock trading symbol
Company name
Announcement event description
Announcement date
Announcement type/category
Example Output
Dependencies
master_isin_map.json— Input file containing all stock ISINspipeline_utils.py— ProvidesBASE_DIRandget_headers()functionrequests— HTTP client library
Configuration
Number of concurrent threads for parallel API requests
Path to master ISIN mapping file
Output file path for aggregated announcements
Threading Implementation
Uses Python’sconcurrent.futures.ThreadPoolExecutor with 40 workers for high-throughput parallel fetching:
Error Handling
- Returns
Noneif HTTP request fails or times out (10s timeout) - Silently skips failed requests (no exception propagation)
- Validates response contains
datafield as a list - Progress tracking: prints status every 100 completed requests
Post-Processing
Results are sorted by date in descending order before saving:Usage Example
Integration
This script is part of Phase 2 (Enrichment) in the EDL Pipeline. The output file is consumed by:add_corporate_events.py— Injects announcements into the “Recent Announcements” field of the final JSON